JULIA possède un système de type et de méthode qui lui confère une approche objet. La fonction typeof() renvoie le type d'une variable de base Int32, Float64... JULIA est conçu pour permettre facilement d'étendre l'environnement à de nouveaux type de variable.
Le types sont organisés suivant un hiérarchie comme on peut le voir sur l'arborescence partielle ci-dessous
(arborescence générée à l'aide de https://github.com/tanmaykm/julia_types/blob/master/julia_types.jl)
In [8]:
    
function f(x::Any)
    gamma(x+1)
end
    
    Out[8]:
In [9]:
    
function f(n::Integer)
    factorial(n)
end
    
    Out[9]:
In [10]:
    
f(3.0)
    
    Out[10]:
In [11]:
    
f(3)
    
    Out[11]:
In [12]:
    
f(im)
    
    Out[12]:
In [13]:
    
f(-2)
    
    
In [14]:
    
factorial(sqrt(2))
    
    
In [84]:
    
abstract Grid # juste en dessous de Any
type Grid1d <: Grid
    debut::Float64
    fin::Float64
    n::Int32
end
    
In [85]:
    
a=Grid1d(0,1,2)
    
    
In [19]:
    
a.debut
    
    Out[19]:
In [20]:
    
a.fin
    
    Out[20]:
In [21]:
    
a.n
    
    Out[21]:
In [37]:
    
A=speye(3,3)
A[1,2]=2
    
    Out[37]:
In [38]:
    
typeof(A)
    
    Out[38]:
In [39]:
    
A.rowval
    
    Out[39]:
In [40]:
    
A.colptr
    
    Out[40]:
In [41]:
    
A.nzval
    
    Out[41]:
In [33]:
    
A.m
    
    Out[33]:
In [34]:
    
A.n
    
    Out[34]:
In [42]:
    
+
    
    Out[42]:
In [86]:
    
function +(g::Grid1d,n::Integer)
    g.n+=n
    return g
end
    
    Out[86]:
In [87]:
    
a=Grid1d(0,1,2)
    
    Out[87]:
In [88]:
    
a+2
    
    Out[88]:
In [90]:
    
a
    
    Out[90]:
In [92]:
    
2+a
    
    
In [95]:
    
+a
    
    
In [96]:
    
a+[1,2]
    
    
In [56]:
    
println(a)
    
    
In [57]:
    
Base.show(a)
    
    
In [73]:
    
function Base.show(io::IO,g::Grid1d)
    print(io, "Grid 1d : début $(g.debut) , fin $(g.fin) , $(g.n) éléments\n")
end
    
    Out[73]:
In [74]:
    
a
    
    Out[74]:
In [76]:
    
function Base.size(g::Grid)
    return g.n
end
    
    Out[76]:
In [77]:
    
size(a)
    
    Out[77]:
In [78]:
    
abstract Grid # juste en dessous de Any
type Grid1d <: Grid
    debut::Float64
    fin::Float64
    n::Int32
    
    # constructeurs par défaut sans argument
    function Grid1d()
        new(0,0,0)
    end
    
    # constructeurs par défaut avec argument
    function Grid1d(a,b,c)
        if c<=0
            error("pas possible")
        else
            new(a,b,c)
        end
    end
end
    
In [82]:
    
b=Grid1d(0,1,-1)
    
    
In [97]:
    
function Base.det(g::Grid1d)
    
    
In [98]:
    
a
    
    Out[98]:
In [99]:
    
a[1]
    
    
In [100]:
    
    
    
In [ ]: